package dbService

import (
	. "backend/config"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"gorm.io/gorm/schema"
)

//var DbConn, err = gorm.Open(mysql.Open("root:990812@tcp(82.156.206.110:4101)/zjxClass?charset=utf8mb4&parseTime=True&loc=Local"),
//	&gorm.Config{
//		NamingStrategy: schema.NamingStrategy{
//			SingularTable: true,
//		}})

//var DbConn, err = gorm.Open(mysql.Open("root:990812@tcp(zjx_mysql:3306)/zjxClass?charset=utf8mb4&parseTime=True&loc=Local"),
//	&gorm.Config{
//		NamingStrategy: schema.NamingStrategy{
//			SingularTable: true,
//		}})

var DbConn *gorm.DB

func Init() {
	DbConn, _ = gorm.Open(mysql.Open(Config.Mysql.Url),
		&gorm.Config{
			NamingStrategy: schema.NamingStrategy{
				SingularTable: true,
			}})
}
